/*
 * @Description:
 * @Author: yeke
 * @Date: 2024-03-27 14:12:38
 * @LastEditors: yeke
 * @LastEditTime: 2024-03-28 22:21:17
 */
import { Module } from '@nestjs/common';
import { UploadService } from './upload.service';
import { UploadController } from './upload.controller';
import { diskStorage } from 'multer';
import { extname, join } from 'path';
import { MulterModule } from '@nestjs/platform-express';
import { FluentFfmpegModule } from '@mrkwskiti/fluent-ffmpeg-nestjs';

@Module({
  imports: [
    FluentFfmpegModule.forRoot(),
    MulterModule.register({
      storage: diskStorage({
        destination: join(__dirname, '../../public/video'),
        filename: (_, file, callback) => {
          const filename = `${new Date().getTime()}${extname(
            file.originalname,
          )}`;
          return callback(null, filename);
        },
      }),
    }),
  ],
  controllers: [UploadController],
  providers: [UploadService],
})
export class UploadModule {}
